package comgame.components;

import com.almasb.fxgl.entity.component.Component;

public class CropComponent extends Component {
    private String cropType;
    private int price;
    private boolean isWatered;
    private boolean isFertilized;
    private String status;

    public CropComponent(int price) {
        this.price = price;
    }
    public CropComponent(String cropType, String status) {
        this.cropType = cropType;
        this.status = status;

    }

    public boolean isWatered() {
        return isWatered;
    }

    public boolean isFertilized() {
        return isFertilized;
    }

    public String getCropType() {
        return cropType;
    }
    public void setCropType(String cropType) {
        this.cropType = cropType;
    }
    public int getPrice() {
        return price;
    }
    public void setPrice(int price) {
        this.price = price;
    }
    public void setFertilized(boolean fertilized) {
        isFertilized = fertilized;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }

    public void water() {
        this.isWatered = true;
        entity.getViewComponent().setOpacity(0.8);
    }
    public void fertilize() {
        this.isFertilized = true;
        // 在这里添加施肥相关逻辑
        entity.getViewComponent().setOpacity(0.8);

    }
    public void grownUp(){
        if(isWatered && isFertilized){
            this.status = "已成熟";
            //成熟后的逻辑
        }
    }
}
